<%@ page import="cumt.wxl.winterolympics.dao.DAO" %>
<%@ page import="cumt.wxl.winterolympics.utils.JDBCUtil" %>
<%@ page import="cumt.wxl.winterolympics.bean.User" %>
<%@ page import="java.util.List" %>
<%@ page import="java.sql.SQLException" %>
<%--
  Created by IntelliJ IDEA.
  User: 1932260390
  Date: 2022/4/28
  Time: 12:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>管理员界面</title>
    <link rel="stylesheet" href="../css/admin.css">
    <link rel="stylesheet" href="../css/background.css">
<%--    <style>--%>
<%--        th, tr, td, table {--%>
<%--            border: 1px solid red;--%>
<%--        }--%>
<%--    </style>--%>
</head>
<body>
<div class="headerBg">
    <!-- 顶部大背景 头图 + 大焦点 -->
    <div id="headerBgImg">
        <p class="head-figure-bg"></p>
        <p class="banner-bg"></p>
    </div>
    <!-- 大焦点雪花动画 -->
    <div id="snowflake">
        <div class="snow"></div>
    </div>
</div>
<div class="TopMenubar">
    <div class="TopMain">
        <ul class="menubar">
            <li class="menuitem" menu-id="1" bold="0">
                <a href="../out-servlet" title="首页" target="_blank">首页</a>
            </li>
            <li class="menuitem" id="menu_project" menu-id="2" bold="0">
                <a href="./project.jsp" title="冬奥项目" target="_blank">项目</a>
            </li>
            <li class="menuitem" menu-id="3" bold="0">
                <a href="./statistics.jsp" title="奖牌榜" target="_blank">奖牌榜</a>
            </li>
        </ul>
        <div class="TopUserInfo">
            <span class="TopUserId">欢迎您： ${admin.adminName }</span>
            <span class="TopLoginOut"><a href="../out-servlet">退出登录</a></span>
        </div>
    </div>
</div>
<div class="UserList">
    <table border="1" cellspacing="0">
        <thead>
        <tr>
            <th width="150">用户账号</th>
            <th width="523">用户密码</th>
            <th width="169">用户邮箱</th>
        </tr>
        </thead>
        <tbody id="userInformation">
        <%
            //        PrintWriter out = response.getWriter();
            JDBCUtil db = new JDBCUtil();
            DAO dao = new DAO();
            String sql = "select * from users";
            List<User> userList = null;
            try {
                userList = dao.getUser(db.getConn(), sql);
            } catch (SQLException e) {
                e.printStackTrace();
            }
            assert userList != null;
            for (User user : userList) {
                out.println("<tr style=\"display: table-row;\"><td>" + user.getUsername() + "</td><td>" + user.getPassword() + "</td><td>" + user.getEmail() + "</td></tr>");
            }
        %>
        </tbody>
    </table>
</div>
</body>
</html>
